package csc.daonjpa.java.domain;


import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity class for Account table. This is a simple POJO class with annotations to define mapping with DB table
 * @author nvu3
 *
 */
@Entity
@PrimaryKeyJoinColumn(referencedColumnName = "id_number" )
public class Account extends BaseInfo {
	private static final long serialVersionUID = 1L;
	
	
	@Column(name = "accountName")
	private String accountName;
	
	@Column(name = "accountType")
	private String accountType;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "dt_created")
	private Date createdDate;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "dt_lst_updt")
	private Date lastUpdatedDate;
	
	@ManyToOne
	@JoinColumn(name="id_customer")
	private Customer customer;
	
	@OneToMany(mappedBy = "account")
	private List<Transactions> transactionList;

	/**
	 * Required constructor
	 */
	public Account() {
	
	}
	
	/**
	 * Other constructor, you can define as many constructors as you want, but the constructor without parameters is required
	 * @param accountNumber
	 * @param accountName
	 * @param accountType
	 */
	public Account(String accountName,
			String accountType, Date createdDate, Date lastUpdatedDate) {
		super();
		this.accountName = accountName;
		this.accountType = accountType;
		this.createdDate = createdDate;
		this.lastUpdatedDate = lastUpdatedDate;
	}
	
	public Account(Double availableAmount,String accountNumber, String accountName,
			String accountType, Date createdDate, Date lastUpdatedDate) {
		super(availableAmount);
		this.accountName = accountName;
		this.accountType = accountType;
		this.createdDate = createdDate;
		this.lastUpdatedDate = lastUpdatedDate;
	}
	/**
	 * @return AccountName
	 */
	public String getAccountName() {
		return this.accountName;
	}

	/**
	 * Set accountName
	 * @param accountName
	 */
	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	/**
	 * @return AccountType
	 */
	public String getAccountType() {
		return this.accountType;
	}

	/**
	 * Set accountType
	 * @param accountType
	 */
	public void setAccountType(String accountType) {
		this.accountType = accountType;
	}
	
	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Date getLastUpdatedDate() {
		return lastUpdatedDate;
	}

	public void setLastUpdatedDate(Date lastUpdatedDate) {
		this.lastUpdatedDate = lastUpdatedDate;
	}
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
}